#########################################################################
# File Name: apply_nw.sh
# Description: update GDAQ config files for Neutron Wall
# Author: asia.rabbit
# mail: asia.rabbit@163.com
# Created Time: Wed 6 Nov 2024 16:02:31 PM CST
#########################################################################
#!/bin/bash

fs=("192.168.0.111" "192.168.0.108" "192.168.0.109" "192.168.0.110")

host=s8
dst0=$host:/home/trunk

dst=$dst0/build/ln_config_file/
dst_ini=$dst0/build/device_card/altera_fe/config.ini

echo destination: $dst

rm -rf 192.*
ssh $host 'rm -rf /home/trunk/build/ln_config_file/*'

# generate the config files according to user config yaml
make -j re
./re nw.yaml
echo configuration files generated.

# transmit the config files
for i in ${fs[@]}; do
  if [ -f $i ]; then
    scp $i $dst
    echo $i transferred to $dst
  else echo file $i does not exist.
  fi
done

scp ../skt/config/ini/config_nw.ini $dst_ini
echo ../skt/config/ini/config_nw.ini copied to $dst_ini
